﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class Registeration : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void UsernameTextBox1_TextChanged(object sender, EventArgs e)
    {

    }
    protected void RegisterButton1_Click(object sender, EventArgs e)
    {
        {

            using (RegisterationDBEntities DB = new RegisterationDBEntities())
            {
                int MobileNumber = int.Parse(MobileNumberTextBox5.Text);


                List<Student_Information> exists = DB.Student_Information.Where(user => user.E_mail == EmailTextBox4.Text || user.Mobile_Number == MobileNumber).ToList();
                if (exists.Count == 0)
                {


                    Student_Information Student = new Student_Information();
                    Student.StudentName = UsernameTextBox1.Text;
                    Student.Password = PasswordTextBox3.Text;
                    Student.Re_Password = ConfirmPassTextBox2.Text;
                    Student.E_mail = EmailTextBox4.Text;
                    Student.Mobile_Number = int.Parse(MobileNumberTextBox5.Text);
                    //string strValue =
                    Student.Gender = GenderRadioButtonList1.SelectedValue;


                    DB.Student_Information.Add(Student);
                    DB.SaveChanges();
                    Response.Redirect("~/Post-Registeration.aspx");

                }
                else
                {
                    RegisterLabel1.Text = "This E-mail Or Mobile Number Is Already Exists\nif You Forget Your Password Click on Forget Your Password Link ";
                }

            }
        }



    }
}